import request from "@/request/request";
import requestMock from "@/request/requestMock";

// 一级列表
export const reqCategoryList1 = () => {
  return request.get("/admin/product/getCategory1");
};
// 二级列表
export const reqCategoryList2 = (category1Id) => {
  return request.get(`/admin/product/getCategory2/${category1Id}`);
};
// 三级列表
export const reqCategoryList3 = (category2Id) => {
  return request.get(`/admin/product/getCategory3/${category2Id}`);
};

//4. 请求mock的banner数据
export const reqBannerList = () => {
  return requestMock.get(`/mock-api/banner`);
};

//5. 请求mock的floor数据
export const reqFloorList = () => {
  return requestMock.get(`/mock-api/floor`);
};


// 6 请求搜索页数据
export const reqSearchList = (searchParams) => {
  return request.post(`/api/list`, searchParams);
};

// 7 请求详情页数据
export const reqDetailList = (skuId) => {
  return request.get(`/api/item/${skuId}`);
};

// 8.添加购物车页面
export const reqaddCartSuccess = (skuId, skuNum) => {
  return request.post(`/api/cart/addToCart/${skuId}/${skuNum}`);
};

// 9.购物车列表
export const reqshopCartList = () => {
  return request.get(`/api/cart/cartList`);
};

// 10.切换单个商品状态
export const reqgoodChecked = (skuID, isChecked) => {
  return request.get(`/api/cart/checkCart/${skuID}/${isChecked}`);
};

// 10.切换全部商品状态
export const reqAllgoodChecked = (isChecked, skuIdList) => {
  return request.post(`/api/cart/batchCheckCart/${isChecked}`, skuIdList);
};

// 11.删除单个商品
export const reqgooddelete = (skuId) => {
  return request.delete(`/api/cart/deleteCart/${skuId}`);
};


// 12.删除选中
export const reqAllgooddelete = (skuIdList) => {
  return request.post(`/api/cart/batchDeleteCart`, skuIdList);
};


// 13.注册
export const reqRegister = (userInfo) => {
  return request.post(`/api/user/passport/register`, userInfo);
};


// 14.获取验证码
export const reqCode = (phone) => {
  return request.get(`/api/user/passport/sendCode/${phone}`);
};

// 15.获取token
export const reqLogin = (userInfo) => {
  return request.post(`/api/user/passport/login`, userInfo);
};


// 16.获取用户信息
export const reqUserMessage = () => {
  return request.get(`/api/user/passport/auth/getUserInfo`);
};

